Description of exported functions, types and constants

1. TPGIParamsBlock.

type
PPGIParamsBlock = ^TPGIParamsBlock;
TPGIParamsBlock = record
pMemAllocator : PMemoryAllocator; // The address of the procedure
                                                    // allocating memory. The procedure
                                                    // is required for correctly deallocating
                                                    // memory after use.

pCallBack : Pointer;                        // Pointer to CallBack function.
pInBuff : Pointer;                           // Pointer to input buffer.
pOutBuff : Pointer;                         // Pointer to output buffer.
                                                    // Filled by plug-in in case of successful
                                                    // execution of the function.
dwInSize : DWORD;                       // Size of input buffer.
dwOutSize : DWORD;                     // Size of output buffer.
                                                    // Filled by plug-in in case of successful
                                                    // execution of the function.
dwInterface : DWORD;                   // Interface ID. Read Only!
dwIndex : DWORD;                        // Index. (For internal use by Resource Tuner).
                                                    // Read Only!
end;

The structure that facilitates interaction with Resource Tuner.

ATTENTION! Under no circumstances should you modify the values marked as Read Only! Changing these values may adversely affect the operation of the program.


2. TMemoryAllocator.

type
PMemoryAllocator = ^TMemoryAllocator;
TMemoryAllocator = function (Size: DWORD): Pointer; stdcall;

Input : Size - DWORD
- Size of requested memory
OutPut: Pointer
- The pointer to allocated memory. In case of failure when allocating memory returns nil.

Prototype of function which allocates memory. Used only to return results to Resource Tuner. All other memory allocation should use standard library calls.

Rather than being permanently loaded into memory, the plug-in uses this function at run-time, to request a buffer of the necessary size from Resource Tuner where the plug-in can store the results of an operation. The plug-in does not need to clear the input buffer, or de-allocate the space after use, as these tasks are performed by Resource Tuner.


3. CallBack Events.

type
PPGICallBack = ^TPGICallBack;
TPGICallBack = procedure (dwPGIID: DWORD; dwEventID: DWORD; pcMessage: PChar); stdcall;

const
evID_PostLogInfo = 0;                  // Posting data to the log. pcMessage
                                                 // contains pointer to the line containing
                                                 // description of the occurred event.

Input : None
Output: dwPGIID - DWORD
- Interface ID. This is intended to uniquely specify a particular event issued by the plug-in if several functions are executing at the same time.

IMPORTANT: ONLY the Interface ID values received from Resource Tuner should be used.


dwEventID - DWORD
- Identifier of the occurred event.

pcMessage - Pointer
- Pointer to the data that is necessary to transmit to Resource Tuner.

The prototype of the function that allows the plug-in to inform Resource Tuner about various events that have occurred at run time.

IMPORTANT: Currently, only Post data to log is supported. To maintain compatibility with future versions of Resource Tuner, use ONLY PREDEFINED EVENT TYPES.


4. PexRegisterPlugIn.

procedure PexRegisterPlugIn(var N: PChar); Export; StdCall;

The procedure called at Plug-in registration.

This should return to Resource Tuner a pointer to the line, which contains the plug-in name. Resource Tuner uses this to associate the plug-in with any menu items and events it provides.

IMPORTANT: The line should not be empty. The plug-in will not be registered if an empty line is given.


5. PexAboutPlugIn.

procedure PexAboutPlugIn; Export; StdCall;

Optional procedure.

If this procedure is present, Resource Tuner adds an entry titled "Plug-ins - About <Name>" to the menu. The name is obtained by Resource Tuner when the plug-in is registered. This menu options allows information about the plug-in to be displayed to the user.


6. PexPreloadImage.

function PexPreloadImage(pPGIPB: PPGIParamsBlock): Boolean; stdcall;

Input:   - the function receives PPGIParamsBlock and uses values sent to it.
Output: - returns True if execution was successful, otherwise it returns False.

The function executed prior to beginning data processing by Resource Tuner.
This function provides a generic means to perform any startup processing. In the body of this function it is possible, for example, to place the code to unpack any packed files, and transmit them to Resource Tuner for further processing.

 Examples: Pascal and C++